define(
    function (require) {
        var BaseFormModel = require('common/FormModel');
        var Data = require('./Data');
        var GlobalData = require('common/GlobalData');
        var m = require('moment');
        var u = require('underscore');

        function FormModel() {
            BaseFormModel.apply(this, arguments);
            var entityName = this.getUrlType();
            this.addData(new Data(entityName));
        }

        FormModel.prototype.prepare = function () {
            BaseFormModel.prototype.prepare.call(this);
            this.set('uploadUrl', '/api/upload/1');

            var price = this.get('price');
            var oldPrice = this.get('oldPrice');
            if (u.isString(price) && price.length > 0
                    && u.isString(oldPrice) && oldPrice.length > 0
            ) {
                this.set('couponChecked', true);
            }
        }

        FormModel.prototype.validateEntity = function (entity) {
            var errorMsg = [];
            if (errorMsg.length > 0) {
                return errorMsg;
            }
            return BaseFormModel.prototype.validateEntity.apply(this, arguments);
        };

        FormModel.prototype.save = function(entity) {
            return BaseFormModel.prototype.save.apply(this, arguments);
        };

        require('er/util').inherits(FormModel, BaseFormModel);
        return FormModel;
    }
);
